<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<!--#include file="../Include/Conn.asp" -->
<!--#include file="../Include/inc.asp" -->
<!--#include file="../Include/Function.asp" -->
<!--#include file="seeion.asp"-->
<!--#include file="upLoad_Class.asp"-->
<html>
<head>
<title>无组件缩略图上传</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link href="images/style.css" type=text/css rel=stylesheet>
<style>
*{mrgin:0px;padding:0px;font-size:12px;}
body{margin:0px;color:#f00;}
body .box{width:250px;height:32px; overflow:hidden; line-height:30px;}
body .box .btn{font-size:12px;background:#5BA4DD;height:25px; display:inline-block; line-height:25px;color:#FFF;cursor:pointer;border:none;margin-left:3px; padding:0px 3px}
body,td,th {font-family: "Microsoft YaHei", Arial, "宋体";}
</style>
</head>
<body>
<%
formname=request("formname")
inputname=request("inputname")
uploadstyle=request("uploadstyle")
dim upload
set upload = new AnUpLoad
upload.Exe = "jpg|bmp|jpeg|gif|png|rar|zip|ppt|doc|swf"
upload.MaxSize = 10 * 1024 * 1024 '2M
upload.GetData()
if upload.ErrorID>0 then 
	response.Write upload.Description
else
	dim file,savpath
	If uploadstyle="logo" Then 
	savepath = "/upload/image/logo"
	ElseIf uploadstyle="News" Then 
	savepath = "/upload/image/News"
	ElseIf uploadstyle="banner" Then 
	savepath = "/upload/image/banner"
	ElseIf uploadstyle="nav" Then 
	savepath = "/upload/image/nav"
	ElseIf uploadstyle="file" Then 
	savepath = "/upload/file"
	End If 
	set file = upload.files("file1")
	if not(file is nothing) then
		set result = file.saveToFile(savepath,0,true)
		if not result.error Then
		    jrfilename=file.filename
            '水印代码位置 
			response.Write "<div class=""box"">上传成功,SIZE:"&GetSize(file.size)&"<a class=""btn"" href=""javascript:history.go(-1)"">继续上传</a></div>"
			jrfilename=file.filename
            Response.write"<script language=javascript>parent.document."&formname&"."&inputname&".value='"&savepath&"/"&jrfilename&"';</script>"
			target=""&savepath&"/"&jrfilename&""
			%>
<% If uploadstyle<>"file" Then  %>
<script type="text/javascript">
function doInterfaceUpload(strValue){
	if (strValue=="") return;
	var objLinkUpload = parent.document.getElementsByName("ImagePath")[0];
	if (objLinkUpload){
		if (objLinkUpload.value!=""){
			objLinkUpload.value = objLinkUpload.value + "|";
		}
		objLinkUpload.value = objLinkUpload.value + strValue;
	}
}
doInterfaceUpload('<%=target%>');
</script>
<script type="text/javascript">
function divMsg(t){
  var pstr=parent.document.getElementById("pw").innerHTML; 
  var imgvalue=parent.document.getElementById("ImagePath").value;

  if(t.indexOf("err:")==-1)
  {
  	var ids=t
	ids=ids.substr(ids.lastIndexOf("/")+1,ids.lastIndexOf("."))
	ids=ids.replace(".","")
  	 var itml = pstr + '<div class="imgDiv" id="'+ids+'"><label><img src="'+ t + '" border="0" /><br><input type="radio" name="imgradio" onclick="setimg(\''+t+'\')" value="'+t+'" />设为缩略图</label> <a href="javascript:dropThisDiv(\''+ids+'\',\''+t+'\')">删除</a></div> ';
	 imgvalue=imgvalue+t+'|';
  }
  else
 {
 	 var itml = pstr + '<div class="imgDiv" id="'+t+'">"'+t+'"<br/>图片上传失败</div> ';
 } 
 parent.document.getElementById("pw").innerHTML=itml;
}
divMsg('<%=target%>')
</script>
<%end if
		else
			response.Write file.Exception
		end if
	end if
end if
set upload = Nothing%>
</body>
</html>